home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / util / cdity / availmem2.lha / AvailMem2 / src / AvailMem2_resize.s < prev    next >
Text File  |  1997-07-01  |  2KB  |  104 lines

  1.  
  2.     machine 68020
  3.  
  4.     * program includes
  5.  
  6.     include    "AvailMem2_gui.i"
  7.     include    "AvailMem2.i"
  8.     include    "lvo.i"
  9.  
  10.     incdir    "include:"
  11.  
  12.     include    "exec/exec.i"
  13.     include    "exec/funcdef.i"
  14.     include    "intuition/intuition.i"
  15.  
  16.     section    code,code        ;availmem code section
  17.  
  18. _HandleResizeMsgs
  19. * * * * * * * * * * * * * * * * * * * * *
  20. *                    *
  21. * Handles resize window msgs.        *
  22. *                    *
  23. * * * * * * * * * * * * * * * * * * * * *
  24.     movem.l    d0-a6,-(sp)        ;push all registers
  25.  
  26.     clr.l    .prg_ResizeClose    ;reset window close variable
  27.  
  28.     tst.l    ResizeWnd        ;check if resize window open
  29.     beq    .no_ResizeWnd        ;skip if not
  30.  
  31. .MsgLoop_Resize
  32.  
  33.     move.l    _GadToolsBase,a6    ;put gadtoolsbase in a6
  34.     move.l    ResizeWnd,a0        ;get ptr to resize window
  35.     move.l    wd_UserPort(a0),a0    ;get window userport
  36.     jsr    _LVOGT_GetIMsg(a6)    ;get any waiting message
  37.     move.l    d0,ptr_TempMsg        ;store msg
  38.     beq    .no_ResizeWnd        ;if no message, continue looping
  39.  
  40.     move.l    ptr_TempMsg,a4        ;put msg in a4
  41.     move.l    im_Class(a4),d4        ;get msg class
  42.  
  43.     cmp.l    #IDCMP_CHANGEWINDOW,d4    ;check if window is changed
  44.     bne    .not_IDCMP_CHANGEWINDOW    ;skip if not
  45.  
  46.     move.l    ResizeWnd,a0        ;put ptr to resize window in a0
  47.  
  48.     * refresh window pos and size
  49.  
  50.     move.w    wd_LeftEdge(a0),ResizeLeft
  51.     move.w    wd_TopEdge(a0),ResizeTop
  52.     move.w    wd_Width(a0),ResizeWidth
  53.     move.w    wd_Height(a0),d0
  54.     move.b    wd_BorderTop(a0),d1
  55.     ext.w    d1
  56.     sub.w    d1,d0
  57.     move.w    d0,ResizeHeight
  58.  
  59.     clr.l    d4
  60. .not_IDCMP_CHANGEWINDOW
  61.  
  62.     cmp.l    #IDCMP_CLOSEWINDOW,d4    ;check if closegadget was pressed
  63.     bne    .not_IDCMP_CLOSEWINDOW    ;skip if not
  64.  
  65.     st.l    .prg_ResizeClose    ;set window close variable
  66.  
  67.     move.w    ResizeLeft,MemoryDisplayLeft
  68.     move.w    ResizeTop,MemoryDisplayTop
  69.     move.w    ResizeWidth,MemoryDisplayWidth
  70.     move.w    ResizeHeight,MemoryDisplayHeight
  71.  
  72.     clr.l    d4            ;reset msg class
  73.  
  74. .not_IDCMP_CLOSEWINDOW
  75.  
  76.     move.l    _GadToolsBase,a6    ;put gadtoolsbase in a6
  77.     move.l    ptr_TempMsg,a1        ;put tempmsg in a1
  78.     jsr    _LVOGT_ReplyIMsg(a6)    ;reply window msg
  79.  
  80.     bra    .MsgLoop_Resize        ;loop message-reader
  81.  
  82. .no_ResizeWnd
  83.  
  84.     tst.l    .prg_ResizeClose    ;check if win should close
  85.     beq    .no_ResizeClose        ;skip if it shouldn't
  86.  
  87.     jsr    _CloseGUI        ;close program GUI
  88.     jsr    _OpenGUI        ;reopen program GUI
  89.     tst.l    d0            ;check if everything went ok
  90.     beq    .Fail            ;bail out if failure
  91.     
  92. .no_ResizeClose
  93.  
  94.     movem.l    (sp)+,d0-a6        ;pop all registers
  95.     clr.l    d0            ;set exitcode to FALSE
  96.     rts                ;return
  97.  
  98. .Fail
  99.     movem.l    (sp)+,d0-a6        ;pop all registers
  100.     st.l    d0            ;set exitcode to TRUE
  101.     rts                ;return
  102.  
  103. .prg_ResizeClose    ds.l    1
  104.